package com.cel.sc;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * EurekaClient22 而不能使用 EurekaClient原因是，spring容器中已存在EurekaClient注册的实例名
 * @author cel
 *
 */
@SpringBootApplication
@EnableEurekaClient
@EnableDiscoveryClient
@RestController
@RefreshScope// 表示此类，下的配置会刷新 
public class EurekaClient22 {

    public static void main(String[] args) {
        SpringApplication.run( EurekaClient22.class, args );
    }
    

    @Value("${server.port}")
    String port;
    
    @Value("${author}")
    String author;
    
    @RequestMapping("/hi")
    public String home(@RequestParam(value = "name", defaultValue = "cel") String name) {
        return "hi " + name + " ,i am from port:" + port+ ",author: "+author;
    }

}